home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / dbase / do1beta.zip / BGIDEMO.DO < prev    next >
Text File  |  1991-08-25  |  3KB  |  126 lines

  1. /*
  2.     demo some of the BGI predicates
  3.     NOTE - the sizes of the shapes drawn here are for a VGA; you may
  4.     want to modify this somewhat for CGA/EGA output
  5. */
  6. #include "bgidef.do"
  7.  
  8. initGraph(DETECT,0,envSymbol("bgipath"));
  9. setTextStyle(SANS_SERIF_FONT,HORIZ_DIR,3);
  10. outText("Welcome to the BGI...Press any key to continue");
  11. setTextStyle(DEFAULT_FONT,HORIZ_DIR,1);
  12. inkey();
  13.  
  14. /*
  15.     text
  16. */
  17. clearDevice();
  18. outTextXY(200,50,"Text Demonstration");
  19. setTextStyle(0,0,1);
  20. outTextXY(100,100,"Default Font");
  21. setTextStyle(1,0,1);
  22. outTextXY(100,150,"Triplex Font");
  23. setTextStyle(2,0,1);
  24. outTextXY(100,200,"Stroked small font");
  25. setTextStyle(3,0,1);
  26. outTextXY(100,250,"Stroked Sans-Serif font");
  27. setTextStyle(4,0,1);
  28. outTextXY(100,300,"Gothic Font");
  29. setTextStyle(4,0,4);
  30. outTextXY(300,300,"Magnified Gothic");
  31. setTextStyle(0,0,1);
  32. inkey();
  33.  
  34. /*
  35.     lines
  36. */
  37. clearDevice();
  38. outTextXY(200,50,"BGI Line Drawing Demonstration");
  39. line(100,100,100,300); % draw a line
  40. setLineStyle(1,0,0);
  41. line(150,100,150,300); % dotted line
  42. setLineStyle(2,0,0);
  43. line(200,100,200,300); % centered line
  44. setLineStyle(3,0,0);
  45. line(250,100,250,300); % dashed line
  46. setLineStyle(4,$0F0F,3); 
  47. line(300,100,300,300); % user defined
  48. setLineStyle(0,0,1);
  49. outTextXY(20,450,"Press any key to continue...");
  50. inkey();
  51.  
  52.  
  53. /*
  54.     circles
  55. */
  56. clearDevice();
  57. outTextXY(350,50,"BGI Circles Demonstration");
  58. for(i=1;i<150;i=i+5) circle(200,200,i);
  59. outTextXY(20,450,"Press any key to continue...");
  60. inkey();
  61.  
  62. /*
  63.     ellipses
  64. */
  65. clearDevice();
  66. outTextXY(200,50,"BGI Ellipse Demonstration");
  67. ellipse(200,200,0,360,200,100);
  68. fillEllipse(300,400,150,50);
  69. outTextXY(20,450,"Press any key to continue");
  70. inkey();
  71.  
  72. /*
  73.     rectangles
  74. */
  75. clearDevice();
  76. outTextXY(200,50,"BGI Rectangle Demonstration");
  77. for(i=10;i<200;i=i+30) rectangle(i,i+10,i+160,i+100);
  78. outTextXY(20,450,"Press any key to continue...");
  79. inkey();
  80.  
  81. /*
  82.     bar graphs
  83. */
  84. clearDevice();
  85. outTextXY(200,50,"BGI 3-D Bar Graph Demonstration");
  86. setFillStyle(HATCH_FILL,YELLOW);
  87. bar3d(100,200,250,300,20,1);
  88. setFillStyle(WIDE_DOT_FILL,WHITE);
  89. bar3d(400,100,500,300,10,1);
  90. outTextXY(100,340,"Bar Graph #1");
  91. outTextXY(400,340,"Bar Graph #2");
  92. outTextXY(22,450,"Press any key to continue...");
  93. readchar();
  94.  
  95. /*
  96.     pie chart
  97. */
  98. clearDevice();
  99. setFillStyle(CLOSE_DOT_FILL,WHITE);
  100. outTextXY(200,50,"BGI Pie Chart Demonstration");
  101. pieSlice(100,200,0,90,100);
  102. pieSlice(100,200,110,140,100);
  103. pieSlice(100,200,180,270,100);
  104. outTextXY(100,320,"Pie Number 1");
  105. pieSlice(400,200,90,279,100);
  106. outTextXY(400,320,"Pie Number 2");
  107. outTextXY(20,400,"Press any key to continue...");
  108. inkey();
  109.  
  110. /*
  111.     polygon
  112. */
  113. clearDevice();
  114. outTextXY(100,50,"BGI drawPoly Demonstration");
  115. setFillStyle(SOLID_FILL,RED);
  116. drawPoly([50,50,100,100,150,150,200,200,150,200,100,250,50,300,50,50]);
  117. fillPoly([300,300,330,330,320,360,310,370,300,380]);
  118. outTextXY(20,450,"Press any key to continue...");
  119. inkey();
  120.  
  121. /*
  122.     end of demo
  123. */
  124. closeGraph();
  125. ? "That's all folks..";
  126.